package com.example.student.service.impl;

import com.example.student.domain.Teacher;
import com.example.student.mapper.TeacherMapper;
import com.example.student.service.TeacherService;
import com.example.student.util.ResponseBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.ArrayList;
import java.util.List;

@Service
public class TeacherServiceImpl implements TeacherService {
    @Autowired
    TeacherMapper teacherMapper;

    @Override
    public ResponseBean getTeacherList() {
        ResponseBean bean = new ResponseBean();

        List<Teacher> list = new ArrayList<Teacher>();
        list = teacherMapper.getTeacherList();
        bean.setData(list);
        int count = teacherMapper.getTeacherListCount();
        bean.setCount(count);
        return bean;
    }

    @Override
    public int addTeacher(Teacher teacher) {
        int isSuccess = teacherMapper.addTeacher(teacher);
        return isSuccess;
    }

    @Override
    public boolean updateTeacher(Teacher teacher) {
        boolean isSuccess = teacherMapper.updateTeacher(teacher);
        return isSuccess;
    }

    @Override
    public boolean deleteTeacher(List<Long> ids) {
        boolean isSucccess = teacherMapper.deleteTeacher(ids);
        return isSucccess;
    }
}
